﻿using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Security.Principal;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;
using System.Web.Security;
using eepg_contratos.Models;
using System.Data;
using eepg_contratos.Utilities;
using System.IO;
using System.Collections;

namespace eepg_contratos.Controllers
{
    public class OtrosController : Controller
    {
        AppUtil u = new AppUtil();

        public ActionResult ProcesoBeneficiariosRenova()
        {
            return View();
        }

        public ActionResult CatalogoTablasRenova()
        {
            return View();
        }

        public String ListarCiclosZonas()
        {
            String lista = "";
            OtrosServices m = new OtrosServices();
            ArrayList arr = new ArrayList();
            arr = m.ListarCiclosZonas();
            lista = u.ArrayToHtml(arr, "only_rows");

            return lista;
        }

        public String ProcesarBeneficiariosPorCicloZonaAction()
        {
            LogProcesoBeneficiarioModel a = new LogProcesoBeneficiarioModel();
            OtrosServices ss = new OtrosServices();

            a.ciclo = Int32.Parse(Request.Form["ciclo"]);
            a.zona = Request.Form["zona"];
            a.guid = Request.Form["guid"];
            if (a.guid.Trim().Length == 0)
            {
                a.guid = Guid.NewGuid().ToString();
            }

            a.usuario_ing = Request.Form["usuario_ing"];

            String mensaje = ss.ProcesarBeneficiariosPorCicloZonaAction(a);

            return mensaje;
        }

        public String CatalogoTablasRenovaAction()
        {
            CatalogoTablaModel a = new CatalogoTablaModel();
            Reportes ss = new Reportes();

            a.nombreTabla = Request.Form["nombreTabla"].ToString();

            String html = ss.PROC_CONSULTA_TABLA_HTML(a.nombreTabla);

            return html;
        }

    }
}
